package com.itggm.controller;

import com.itggm.DTO.RecruitPageDTO;
import com.itggm.pojo.Recruit;
import com.itggm.response.ResponseResult;
import com.itggm.service.RecruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: ggm
 * @data 2024年11月21日 11:51
 */
@RestController
@RequestMapping("recruit")
public class RecruitController {
    @Autowired
    private RecruitService recruitService;

    /**
     * @Author: ggm
     * @date: 2024/11/21
     * 分页查询
     */

    @GetMapping("/page")
    public ResponseResult page(RecruitPageDTO recruitPageDTO) {
        return recruitService.page(recruitPageDTO);
    }

    /**
     * @Author: ggm
     * @date: 2024/11/21
     * 添加
     */
    @PostMapping("/add")
    public ResponseResult add(@RequestBody Recruit recruit) {
        return recruitService.add(recruit);

    }

    /**
     * @Author: ggm
     * @date: 2024/11/21
     * 批量删除
     */
    @PostMapping("/delete")
    public ResponseResult delete(@RequestBody List<Integer> ids) {
        return recruitService.delete(ids);

    }

    /**
     * @Author: ggm
     * @date: 2024/11/21
     * 编辑
     */
    @PostMapping("/edit")
    public ResponseResult edit(@RequestBody Recruit recruit) {
        return recruitService.edit(recruit);

    }

    /**
     * @Author: ggm
     * @date: 2024/11/21
     * 更新招聘状态
     */
    @PostMapping("/editStatus")
    public ResponseResult editStatus(Integer id, Integer isDelete, Integer version) {
        return recruitService.editStatus(id,isDelete,version);
    }
     /**
      * @Author: ggm
      * @date:  2024/11/21
      * 渲染前端招聘列表
      */
     @GetMapping("/front/list")
     public ResponseResult RecruitList(Integer limit){
         return recruitService.RecruitList(limit);

     }



}
